﻿using Sunny.UI;

namespace CoreShop.App
{
    public partial class UIPayment : UIDropDownItem
    {
        public UIPayment()
        {
            InitializeComponent();

            uiButton1.Text = "整单手动打折/" + '\n' + "         减免";

            uiFlowLayoutPanel2.Clear();
            uiFlowLayoutPanel2.Add(new UIPaymentItem("商品价格合计", "￥100284"));
            uiFlowLayoutPanel2.Add(new UIPaymentItem("员工8折", "-￥20056.8"));
            uiFlowLayoutPanel2.Add(new UIPaymentItem("抹零", "-￥0.2"));
            UIPaymentItem info = new UIPaymentItem("应收", "￥80227", "抹零");
            info.ButtonClick += Info0_ButtonClick;
            uiFlowLayoutPanel2.Add(info);
            uiFlowLayoutPanel2.Add(new UIMenuItemSeparator("", 20));
            info = new UIPaymentItem("微信(自)", "￥190", "撤销");
            info.ButtonClick += Info1_ButtonClick;
            uiFlowLayoutPanel2.Add(info);

            btnPay.Text = "还差￥80037";
            btnPay.Enabled = false;
        }

        private void Info0_ButtonClick(object sender, System.EventArgs e)
        {
            UIMessageTip.ShowOk("抹零");
        }

        private void Info1_ButtonClick(object sender, System.EventArgs e)
        {
            UIMessageTip.ShowOk("撤销");
        }

        private void uiButton1_Click(object sender, System.EventArgs e)
        {
            UIButton btn = (UIButton)sender;
            btn.Selected = true;
        }

        private void btnPay_Click(object sender, System.EventArgs e)
        {
            Close();
        }
    }
}
